package com.lw.kotlin_mvvm_master.view.user

import com.lw.common.base.BaseViewModel
import com.lw.kotlin_mvvm_master.api.Api
import com.lw.common.network.request.ApiResponse
import com.lw.common.network.request.BaseRepository
import com.lw.kotlin_mvvm_master.model.LoginRequest
import com.lw.kotlin_mvvm_master.model.LoginModel

class UserViewModel : BaseViewModel() {
    private val repository by lazy { BaseRepository() }

    suspend fun geUserInfo(username: String, password: String): ApiResponse<LoginModel> {
        return repository.executeHttp { Api.service.login(LoginRequest(username, password)) }
    }
}